<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('合作伙伴管理')"/>
    <th:block th:include="include :: jasny-bootstrap-css" />
</head>
<body class="gray-bg">
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="user:partner:add">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="user:partner:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            </a>

            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="user:partner:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('user:partner:edit')}]];
    var removeFlag = [[${@permission.hasPermi('user:partner:remove')}]];
    var datas = [[${@dict.getType('sys_normal_disable')}]];
    var prefix = ctx + "user/partner";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "合作伙伴",
            columns: [{
                checkbox: true
            },
                {
                    field: 'partnerId',
                    title: '编号',
                    sortable: true
                },
                {
                    field: 'partnerName',
                    title: '伙伴名称'
                },

                {
                    field: 'partnerLogo',
                    title: 'logo',
                    formatter: function(value, row, index) {
                        return '<img style="width:50px;height:50px;"  src="' + row.partnerLogo + '"/>';
                    }
                },
                {
                    field: 'partnerNet',
                    title: '网址'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.partnerId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.partnerId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);

    });

</script>
</body>
</html>
